package com.joysuch.wwyt.bp.service;

import com.joysuch.wwyt.bp.bean.PositionCheckBean;
import com.joysuch.wwyt.bp.bean.investigate.BpInvestigateRecordBean;
import com.joysuch.wwyt.bp.bean.investigate.BpInvestigateRecordQueryBean;
import com.joysuch.wwyt.bp.bean.investigate.vo.BpInvestigateRecordVO;
import com.joysuch.wwyt.bp.bean.investigate.vo.TaskItemMapperVo;
import com.joysuch.wwyt.bp.entity.dto.BpInvestigateRecordItemDto;
import com.joysuch.wwyt.bp.entity.dto.DeleteInvestigateRecordDto;
import com.joysuch.wwyt.bp.entity.investigate.BpInvestigatePlan;
import com.joysuch.wwyt.bp.entity.investigate.BpInvestigateRecord;
import com.joysuch.wwyt.bp.entity.investigate.BpInvestigateRecordItem;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import com.joysuch.wwyt.core.exception.ApiBusinessException;
import com.joysuch.wwyt.core.exception.ApiCoreException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;

/**
 * @Author ZhangDong
 * @Date 2020/3/26 9:34
 */
public interface BpInvestigateRecordService {

    ResultBean save(BpInvestigateRecordBean bean);

    ResultBean delete(Long id);

    ResultBean getById(Long id, Integer flag);

    ResultBean page(BpInvestigateRecordQueryBean bean, Integer flag);

    ResultBean exceptionHandle(Long id);

    ResultBean repair(Long recordId, Long checkItemId);

    void repairV2(Long itemId);

    /**
     * 计划恢复有效状态
     *
     * @param itemId
     */
    void changePlanInvalid(Long itemId, String url);

    void excelExport(BpInvestigateRecordQueryBean bean, HttpServletRequest request, HttpServletResponse response);

    ResultBean deleteByIds(List<Long> ids);

    String calculateExceptionHandleStatus(List<BpInvestigateRecordItem> recordItemList, long exceptionCount);

    List<TaskItemMapperVo> saveBatch(List<BpInvestigateRecordVO> bean);

    Long saveV2(BpInvestigateRecordVO recordVO) throws ApiBusinessException;

    /**
     * 隐患排查前位置校验
     *
     * @param userId
     * @param pointId
     * @return
     * @throws Exception
     */
    PositionCheckBean positionCheck(Long userId, Long pointId, Long taskId) throws Exception;

    void updateSummaryTask(final Date taskCheckDate, final Long taskId, final String action, final Long userId);

    String calculateExceptionHandleStatus(String checkResult, List<String> exceptionProcessList);

    void exceptionNotify(BpInvestigateRecord record, BpInvestigatePlan plan);


    Long repairNewWf(Long itemId, String wfProcessInsId, String wfProcessStatus) throws ApiCoreException;

    List<BpInvestigateRecordItemDto> findWfRecordItemList();

    boolean updateWfRecordItemByIds(String status, List<Long> ids);

    boolean updateWfRecordItemHisByIds(String status, List<Long> ids);

    List<Long> saveV3(List<BpInvestigateRecordVO> recordVOList);

    List<DeleteInvestigateRecordDto> getFinishNewSourceTask(Long lastRecordId);

}
